/*
package com.xiaoluyy.demo.config;

import com.xiaoluyy.demo.core.service.ICouponStockSyncService;
import com.xiaoluyy.demo.core.service.DeliveryScanJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class QuartzConfig {

	@Autowired
	private IDeliveryBizService deliveryBizService;

	@Autowired
	private ICouponStockSyncService couponStockSyncService;


	private static Logger log = LoggerFactory.getLogger(QuartzConfig.class);

	@Bean
	public JobDetailFactoryBean jobDetail() {
		JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();
		jobDetailFactoryBean.setJobClass(DeliveryScanJob.class);
		Map jobData = new HashMap<String, Object>();
		jobData.put("deliveryBizService", deliveryBizService);
		jobDetailFactoryBean.setJobDataAsMap(jobData);
		jobDetailFactoryBean.setDurability(true);
		return jobDetailFactoryBean;
	}

	@Bean
	public SimpleTriggerFactoryBean simpleTriggerBean() {
		SimpleTriggerFactoryBean simpleTriggerFactoryBean = new SimpleTriggerFactoryBean();
		simpleTriggerFactoryBean.setJobDetail(jobDetail().getObject());
		simpleTriggerFactoryBean.setRepeatInterval(30000);
		return simpleTriggerFactoryBean;
	}


	@Bean
	public JobDetailFactoryBean stockJobDetail() {
		JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();
		jobDetailFactoryBean.setJobClass(CouponStockSyncJob.class);
		Map jobData = new HashMap<String, Object>();
		jobData.put("couponStockSyncService", couponStockSyncService);
		jobDetailFactoryBean.setJobDataAsMap(jobData);
		jobDetailFactoryBean.setDurability(true);
		return jobDetailFactoryBean;
	}

	@Bean
	public SimpleTriggerFactoryBean stockTriggerBean() {
		SimpleTriggerFactoryBean simpleTriggerFactoryBean = new SimpleTriggerFactoryBean();
		simpleTriggerFactoryBean.setJobDetail(stockJobDetail().getObject());
		simpleTriggerFactoryBean.setRepeatInterval(10000);
		return simpleTriggerFactoryBean;
	}

	@Bean
	public SchedulerFactoryBean trigger() {
		SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
		schedulerFactoryBean.setTriggers(simpleTriggerBean().getObject(),stockTriggerBean().getObject());
		return schedulerFactoryBean;
	}

}
*/
